home *** CD-ROM | disk | FTP | other *** search
- /* strcspn.c From TC Bible page 280 Use strcspn to locate the position
- of the first occurance in a string of any character from another. */
-
- #include <stdio.h>
- #include <string.h>
- char *digits = "0123456789";
- main()
- {
- int loc;
- char str1[80];
- printf("Enter a number followed by other \ characters: ");
- gets(str1);
- loc = strcspn(str1, digits);
- printf("First non-numeric character in \
- \n%s\nis at location %d\n",str1, loc);
-
- }